<template>
  <div class="collect">
    <TitleNav>
      <template> 我的收藏 </template>
    </TitleNav>
    <van-divider />
    <div class="text" v-if="collectList.length === 0">没有更多了</div>
  </div>
</template>

<script>
import TitleNav from '@/components/titleNav.vue'
import axios from 'axios'

export default {
  name: 'Index-collect',
  data() {
    return {
      page: 1,
      pageSize: 10,
      collectList: [],
    }
  },
  components: {
    TitleNav,
  },
  created() {
    this.selectData()
  },
  methods: {
    async selectData() {
      const res = await axios('http://interview-api-t.itheima.net/h5/interview/opt/list', {
        params: {
          optType: 2,
          pageSize: this.pageSize,
          page: this.page,
        },
        headers: {
          Authorization: `Bearer ${localStorage.getItem('token')}`,
        },
      })
      console.log(res)
      if (res.status === 200) {
        this.collectList = res.data.data.rows
      }
      this.page++
    },
  },
}
</script>

<style lang="less" scoped>
.text {
  color: #969799;
  font-size: 3.73333vw;
  line-height: 8.33333vw;
  text-align: center;
}
</style>
